<?php if (!defined('THINK_PATH')) exit(); /*a:1:{s:67:"E:\xampp\htdocs\xintianfei\public/../app/home\view\eight\eight_index.html";i:1509954879;}*/ ?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title>幸运28</title>
    <script src="__JS__/jquery-1.6.2.min.js" ></script>
    <script src="__JS__/mui.min.js"></script>
    <script src="__JS__/index.js" ></script>
    <script src="__JS__/layer.js"></script>
    <script src="__JS__/common.js" ></script>
    <link href="__CSS__/mui.min.css" rel="stylesheet"/>
    <link rel="stylesheet" type="text/css" href="__CSS__/index.css"/>
    <script type="text/javascript" charset="utf-8">
        mui.init();
        mui('.mui-scroll-wrapper').scroll();
    </script>
</head>
<body id="index">
<nav class="mui-bar mui-bar-tab" id="ico">
    <a class="mui-tab-item "  href="<?php echo url('Index/index'); ?>" >
        <span class="mui-icon" ><img src="__IMG__/ico_f01.png"/></span>
        <span class="mui-tab-label">大厅</span>
    </a>
    <a class="mui-tab-item  hall_car "  href="<?php echo url('Ssc/index'); ?>">
        <span class="mui-icon"><img  src="__IMG__/ico_f08.png"/></span>
        <span class="mui-tab-label">重庆时时彩</span>
    </a>
    <a class="mui-tab-item  hall_car "  href="race.html">
        <span class="mui-icon"><img  src="__IMG__/ico_f07.png"/></span>
        <span class="mui-tab-label">香港赛马</span>
    </a>
    <a class="mui-tab-item  hall_car "  href="<?php echo url('Car/index'); ?>">
        <span class="mui-icon"><img  src="__IMG__/ico_f02.png"/></span>
        <span class="mui-tab-label">北京赛车</span>
    </a>
</nav>
<div class="mui-content" id="hall" style="margin-bottom: 40px;">
    <div class="hall_main0" >
        <div class="font_02">
            <img src="__IMG__/logo28.png" alt="" />
            <span class="clock">
					<strong id="minute_show">00</strong> :
					<strong id="second_show">00</strong>
				</span>
        </div>
        <p class="mui-text-center" id="fd" style="color: #fff;visibility: hidden;">开奖窗口</p>
        <div class="mui-clearfix">
            <p class="ru_tr mui-pull-right">
                <span class="record  "><a href="<?php echo url('Center/tou'); ?>" style="color: #fff;">记录</a></span>
                <span class="trend " >走势</span>
            </p>
            <p class="font_02_01">
                <span class="mui-pull-left">开奖时间：<i class="red1" id="dateline"><?php echo date('H:i',$dateline); ?></i>	</span>
                <span class="mui-pull-right">下一期：<i class="red1" id="stage_next"><?php echo $stage_next; ?></i></span>
            </p>
        </div>
        <p  class="padding_lr10 yellow2 result">
            第
            <span class="red1" id="stage"><?php echo $stage; ?></span>
            期开奖结果：
            <i id="sum_dx"><?php echo eightDx($number_sum); ?></i>
            <i id="sum_ds"><?php echo eightDs($number_sum); ?></i>
        </p>
        <div class="winning ks ">
            <?php if(is_array($number) || $number instanceof \think\Collection || $number instanceof \think\Paginator): $i = 0; $__LIST__ = $number;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?>
            <div>
                <dl class="mui-pull-left">
                    <dt id="wei_<?php echo $i-1; ?>" class="BallNum"><?php echo $v; ?></dt>
                    <dd><?php echo $wei[$i-1]; ?></dd>
                </dl>
                <?php if(($i == 3)): ?>
                <span class="mui-pull-left equal"><img src="__IMG__/equal.png"/></span>
                <?php else: ?>
                <span class="mui-pull-left"><img src="__IMG__/add.png"/></span>
                <?php endif; ?>
            </div>
            <?php endforeach; endif; else: echo "" ;endif; ?>
            <div>
                <dl class="mui-pull-left">
                    <dt class="BallNum" id="wei_sum"><?php echo $number_sum; ?></dt>
                    <dd>和值</dd>
                </dl>
            </div>
        </div>
    </div>
    <table border="" cellspacing="" cellpadding="" class="hall_trend">
        <tr>
            <th colspan="6" style="text-align: left;padding-left: 10px;">
                北京赛车时时彩走势
                <span class="mui-pull-right remove">x</span>
            </th>
        </tr>
        <tbody id="tbody">
        </tbody>
    </table>
    <ul class="hall_main1 luck_28">
        <span class="mui-pull-left"><i class="rule">规则</i> </span>
        <li data-name="one" class="active"><i>猜组合</i> </li>
        <li data-name="two"><i>猜特码</i> </li>
        <li data-name="three"><i>猜大小单双</i> </li>
        <li data-name="four"><i>猜极大极小</i> </li>
    </ul>
    <div class="mui-clearfix hall_content">
        <div class="mui-pull-left hall_font active special4" data-name="one">
            <form id="form_one" method="post" action="<?php echo url('betting'); ?>">
                <input type="hidden" value="1" name="type"/>
                <div class="hall_font_main active">
                    <div class="mui-clearfix">
                        <p class="hall_font1 mui-pull-left">猜组合  </p>
                        <p class="pay_money mui-pull-right">
                            <span class="mui-text-center">余额:</span>
                            <span class="red1 money_num"><i><?php echo $users['money']; ?></i>元</span>
                            <span class="red1 refresh">刷新</span>
                        </p>
                    </div>
                    <div class="package">
                        <ul class="hall_font2">
                            <li><i>大单<input type="checkbox" hidden  name="num" value="大单" data-bet="<?php echo getBet(19); ?>" data-title=""></i></li>
                            <li><i>小单<input type="checkbox" hidden  name="num" value="小单" data-bet="<?php echo getBet(19); ?>" data-title=""></i></li>
                            <li><i>大双<input type="checkbox" hidden  name="num" value="大双" data-bet="<?php echo getBet(19); ?>" data-title=""></i></li>
                            <li><i>小双<input type="checkbox" hidden  name="num" value="小双" data-bet="<?php echo getBet(19); ?>" data-title=""></i></li>
                        </ul>
                        <ul class="hall_font2 all font_12">
                            <li class="whole"><i>全</i></li>
                            <li class="clear"><i>清</i></li>
                        </ul>
                    </div>
                </div>
                <div class="hall_font_main " name="rule">
                    <p class="hall_font11 back_re" ><img src="__IMG__/back.png" alt="" /> 返回</p>
                    <p class="yellow1">【猜组合】</p>
                    <p>开出的号码小于或等于13为小,大于或等于14为大 ， 偶数为双，奇数为单，竞猜 [大单]  [小单]  [大双] ， [小双]</p>
                    <p>
                        【大单】     <br />
                        含本<?php echo getOdds(47); ?>倍，限额：<?php echo getBet(19); ?>。 <br />
                        【小单】 <br />
                        含本<?php echo getOdds(48); ?>倍，限额：<?php echo getBet(19); ?>。   <br />
                        【大双】    <br />
                        含本<?php echo getOdds(49); ?>倍，限额：<?php echo getBet(19); ?>。<br />
                        【小双】 <br />
                        含本<?php echo getOdds(50); ?>倍，限额：<?php echo getBet(19); ?>。<br />
                    </p>
                </div>
            </form>
        </div>
        <div class="mui-pull-left hall_font  special" data-name="two">
            <form id="form_two" method="post" action="<?php echo url('betting'); ?>">
                <input type="hidden" value="2" name="type"/>
                <div class="hall_font_main active">
                    <div class="mui-clearfix">
                        <p class="hall_font1 mui-pull-left"> 猜特码</p>
                        <p class="pay_money mui-pull-right">
                            <span class="mui-text-center">余额:</span>
                            <span class="red1 money_num"><i><?php echo $users['money']; ?></i>元</span>
                            <span class="red1 refresh">刷新</span>
                        </p>
                    </div>
                    <div class="package">
                        <ul class="hall_font2">
                            <?php $__FOR_START_19636__=0;$__FOR_END_19636__=28;for($i=$__FOR_START_19636__;$i < $__FOR_END_19636__;$i+=1){ ?>
                                <li><i><?php echo $i; ?><input type="checkbox" hidden  name="num" value="<?php echo $i; ?>" data-bet="<?php echo getBet(20); ?>" data-title=""></i></li>
                            <?php } ?>
                        </ul>
                        <ul class="hall_font2 all font_12">
                            <li class="whole"><i>全</i></li>
                            <li class="clear"><i>清</i></li>
                        </ul>
                    </div>
                </div>
                <div class="hall_font_main" name="rule">
                    <p class="hall_font11 back_re" ><img src="__IMG__/back.png" alt="" /> 返回</p>
                    <p class="yellow1">【猜特码】</p>
                    <p>
                        从0-27中任意选择1个数字组成一注，所选号码与开奖后三位之和相同，即为中奖。<br />

                        赔率：含本<?php echo getOdds(51); ?>倍，限额：<?php echo getBet(20); ?>。 <br />
                    </p>

                </div>
            </form>
        </div>
        <div class="mui-pull-left hall_font special4  "  data-name="three">
            <form id="form_three" method="post" action="<?php echo url('betting'); ?>">
                <input type="hidden" value="3" name="type"/>
                <div class="hall_font_main active">
                    <div class="mui-clearfix">
                        <p class="hall_font1 mui-pull-left">  猜大小单双</p>
                        <p class="pay_money mui-pull-right">
                            <span class="mui-text-center">余额:</span>
                            <span class="red1 money_num"><i><?php echo $users['money']; ?></i>元</span>
                            <span class="red1 refresh">刷新</span>
                        </p>
                    </div>
                    <div class="package">
                        <ul class="hall_font2">
                            <li><i>大<input type="checkbox" hidden  name="num" value="大" data-bet="<?php echo getBet(21); ?>" data-title=""></i></li>
                            <li><i>小<input type="checkbox" hidden  name="num" value="小" data-bet="<?php echo getBet(21); ?>" data-title=""></i></li>
                            <li><i>单<input type="checkbox" hidden  name="num" value="单" data-bet="<?php echo getBet(21); ?>" data-title=""></i></li>
                            <li><i>双<input type="checkbox" hidden  name="num" value="双" data-bet="<?php echo getBet(21); ?>" data-title=""></i></li>
                        </ul>
                        <ul class="hall_font2 all font_12">
                            <li class="whole"><i>全</i></li>
                            <li class="clear"><i>清</i></li>
                        </ul>
                    </div>
                </div>
                <div class="hall_font_main " name="rule">
                    <p class="hall_font11 back_re"><img src="__IMG__/back.png" alt="" /> 返回</p>
                    <p class="yellow1">【玩法说明】</p>
                    <p >
                        开出之号码小于或等于13为小，大于或等于14为大。<br />
                        开出的号码为偶数为双，号码为奇数为单。<br />
                        赔率：含本<?php echo getOdds(52); ?>倍，限额：<?php echo getBet(21); ?>。 <br />
                    </p>
                </div>
            </form>
        </div>
        <div class="mui-pull-left hall_font  special4" data-name="four">
            <form id="form_four" method="post" action="<?php echo url('betting'); ?>">
                <input type="hidden" value="4" name="type"/>
                <div class="hall_font_main active">
                    <div class="mui-clearfix">
                        <p class="hall_font1 mui-pull-left">猜极大极小  </p>
                        <p class="pay_money mui-pull-right">
                            <span class="mui-text-center">余额:</span>
                            <span class="red1 money_num"><i><?php echo $users['money']; ?></i>元</span>
                            <span class="red1 refresh">刷新</span>
                        </p>
                    </div>
                    <div class="package">
                        <ul class="hall_font2">
                            <li><i>极大<input type="checkbox" hidden  name="num" value="极大" data-bet="<?php echo getBet(22); ?>" data-title=""></i></li>
                            <li><i>极小<input type="checkbox" hidden  name="num" value="极小" data-bet="<?php echo getBet(22); ?>" data-title=""></i></li>
                        </ul>
                        <ul class="hall_font2 all font_12">
                            <li class="whole"><i>全</i></li>
                            <li class="clear"><i>清</i></li>
                        </ul>
                    </div>
                </div>
                <div class="hall_font_main " name="rule">
                    <p class="hall_font11 back_re" ><img src="__IMG__/back.png" alt="" /> 返回</p>
                    <p class="yellow1">【猜极大极小】</p>
                    <p>
                        开出的三个号码加总为和值，可能的结果为0-5为极小，22-27为极大<br />
                        赔率：含本<?php echo getOdds(53); ?>倍，限额：<?php echo getBet(22); ?>。 <br />
                    </p>

                </div>
            </form>
        </div>

    </div>
    <div class="hall_font31 mui-scroll-wrapper">
        <input type="text" name="" id="money" value="" placeholder="下注金额" style="width: 33.33%;font-size: 12px;"/>
        <button>共<span id="zhu" class="red1">0</span>注</button>
        <button id="form_submit">确认</button>
    </div>
</div>
<script type="text/javascript">
    var opening =true;
    var flash =true;
    function getCountDown(){
        var timestamp = "<?php echo $dateline; ?>";
        setInterval(function(){
            var nowTime = new Date();
            var endTime = new Date(timestamp * 1000);
            var t = endTime.getTime() - nowTime.getTime();
            if(t>300000){  //2-9.30 封盘
                opening = false;
                $('#fd').html('封盘中 9:05 - 23:55 开盘').css('visibility','inherit');
            }else if(t>=0){
                $('#fd').css('visibility','hidden');
                var min=Math.floor(t/1000/60%60); //计算分
                var sec=Math.floor(t/1000%60);      //计算秒
                if(t <= 30000){    //30s后封盘
                    opening = false;
                    $('#fd').html('已封单').css('visibility','inherit');
                }
                if (min < 10) {
                    min = "0" + min;
                }
                if (sec < 10) {
                    sec = "0" + sec;
                }
                $('#minute_show').html(min);
                $('#second_show').html(sec);
            }else{
                if(flash){
                    flash= false;
                    $('#fd').html('开奖中...').css('visibility','inherit');
//                    (function longPolling() {
//                        $.ajax({
//                            url: "<?php echo url('Api/checkOpenEight'); ?>",
//                            data: {stage:$('#stage_next').html()},
//                            type:'POST',
//                            dataType: "json",
//                            timeout: 20000,//20秒超时，可自定义设置
//                            error: function (XMLHttpRequest, textStatus, errorThrown) {
//                                if (textStatus == "timeout") { // 请求超时
//                                    longPolling(); // 递归调用
//                                }
//                            },
//                            success: function (data, textStatus) {
//                                if (data.status == 1) { // 请求成功
//                                    $('#stage_next').html(data.stage_next);
//                                    $('#dateline').html(data.time_next);
//                                    $('#stage').html(data.stage);
//                                    $('#sum_dx').html(data.dx);
//                                    $('#sum_ds').html(data.ds);
//                                    var sum = 0;
//                                    var number = data.number.split(',')
//                                    $.each(number,function(i,k){
//                                        sum = sum + parseInt(k);
//                                        $('#wei_'+i).html(k);
//                                    });
//                                    $('#wei_sum').html(sum);
//                                    timestamp  =data.dateline;
//                                    flash = true;
//                                    opening = true;
//                                }
//                            }
//                        });
//
//                    })();

                }
            }
        },1000);
    }

    function ajax_from(self,current) {
        var number =[];
        var count_number=0;
        if(current == 'one' || current == 'two' ||  current == 'three' || current == 'four'){
            self.find('input[name=num]:checked').each(function () {
                number.push($(this).val());
            });
            count_number = count_number + number.length;
        }else if(current == 'five'){
            var ge = self.find('.package').length;
            for (var i=1;i<=ge;i++)
            {
                var one = [];
                self.find('input[name=num_'+i+']:checked').each(function () {
                    one.push($(this).val());
                });
                count_number = count_number + one.length;
                number.push(one);
            }
        }
        if(count_number == 0){
            pop('至少选择一个号码');
            return false;
        }
        var money = $('#money').val();
        if(money == ''){
            pop('请填写投注金额');
            return false;
        }
        cpOpenMing(self,number,money)
    }
    /*彩票弹出*/
    function cpOpenMing(self,number,money) {
        var stage = $('#stage_next').html();
        var html = '<ul>';
        var open_ming = true;
        $.each(number,function (i,j) {
            if(jQuery.isArray(j)){
                if(open_ming  && j.length > 0){
                    $.each(j,function (k,v) {
                        if(self.selector == "#form_three"){
                            var bet = self.find('.package').find('input[value='+v+']').attr('data-bet');
                            var title = self.find('.package').find('input[value='+v+']').attr('data-title');
                        }else{
                            var bet = self.find('.package').eq(i).find('input[value='+v+']').attr('data-bet');
                            var title = self.find('.package').eq(i).find('input[value='+v+']').attr('data-title');
                        }
                        var bets = bet.split('-');
                        if(Number(money) < Number(bets[0]) || Number(money) > Number(bets[1])){
                            pop(title+'投注金额需在'+bet+'内');
                            open_ming =false;
                            return false;
                        }
                        html += '<li><span>期数:'+stage+'</span><span>号码:<i>['+getWei(i,self.find('input[name=type]').val())+'] '+v+'</i></span>金额:'+money+'</li>';
                    })
                }
            }else{
                var bet = self.find('.package').find('input[value='+j+']').attr('data-bet');
                var title = self.find('.package').find('input[value='+j+']').attr('data-title');
                var bets = bet.split('-');
                if(Number(money) < Number(bets[0]) || Number(money) > Number(bets[1])){
                    pop(title+'投注金额需在'+bet+'内');
                    open_ming =false;
                    return false;
                }
                html += '<li><span >期数:'+stage+'</span><span>号码:<i>'+j+'</i></span>金额:'+money+'</li>';
            }
        })
        html += '</ul>';
        if(open_ming){
            layer.open({
                content:html
                ,btn: ['立即投注', '取消']
                ,skin: 'footer'
                ,scrollbar: true
                ,yes: function(index){
                    postCp(self,number,money);
                    layer.close(index);
                }
            });
        }
    }

    /*提交*/
    function postCp(self,number,money) {
        number = JSON.stringify(number);
        var type = self.find('input[name=type]').val();
        var zhu= $('#zhu').html();
        $.post(self.attr("action"),{number:number,type:type,stage:$('#stage_next').html(),money:money,zhu:zhu},success,"json");
        $('#form_submit').attr('disabled',true);
        return false;
        function success(data){
            if(data.code){
                self.find('input[type=submit]').attr('disabled',true);
                pop(data.msg,data.url);
            } else {
                $('#form_submit').attr('disabled',false);
                pop(data.msg);
            }
        }
    }
    //定位
    function getWei(i,type) {
        if(type==1){
            var wei = ['百位','十位','个位'];
        }
        return wei[i];
    }
    $(function () {
        getCountDown();
        //获取走势
        $('.trend').click(function () {
            $.post('<?php echo url("trend"); ?>', {}, success, "json");
            return false;
            function success(data) {
                if (data) {
                    var html = '';
                    $.each(data, function (k, v) {
                        html += '<tr><td>' + k + '</td><td style="width: 40%">';
                        var num = v.number.split(',');
                        var hezhi = 0;
                        $.each(num, function (i, j) {
                            hezhi = hezhi + parseInt(j);
                            html += '<i style="width: 10%" class="bg_' + j + '">' + j + '</i>';
                        })
                        if (hezhi < 10) {
                            hezhi = '0' + hezhi;
                        }
                        //判断大小
                        if(hezhi<=13){
                            dx = '小';
                        }else if(hezhi>=14){
                            dx = '大';
                        }
                        //判断单双
                        if(hezhi%2 ==0) {
                            ds = '双';
                        }else{
                            ds = '单';
                        }
                        html += '</td><td ><span class="red1">' + hezhi + '</span></td>' +
                            '<td ><span class="bule1">' + dx + '</span></td>' +
                            '<td ><span class="bule1">' + ds + '</span></td>' +
                            '</tr>';
                    })
                    $('#tbody').html(html);
                }
            }
        })

        //刷新余额
        $('.refresh').click(function () {
            $.post('<?php echo url("refresh"); ?>','',success,"json");
            return false;
            function success(data){
                if(data.code){
                    $('.money_num i').html(data.money);
                }
            }
        })

        //提交投注
        $('#form_submit').click(function () {
            if(opening == false){
                pop('处于封盘中');
                return false;
            }
            var current = $(".hall_main1 li.active").attr("data-name");
            var self = $('#form_'+current);
            ajax_from(self,current);
        })
        //全选
        $('.whole').click(function () {
            if($(this).parents().is('.package')){
                $(this).parents('.package').find('li').addClass('red0');
                $(this).parents('.package').find('input:checkbox').attr('checked', true);
                $(this).removeClass('red0');
                $('.clear').removeClass('red0');
            }else{
                $(this).parents('.hall_font_main').find('.package li').addClass('red0');
                $(this).parents('.hall_font_main').find('.package input:checkbox').attr('checked', true);
                $(this).removeClass('red0');
                $('.clear').removeClass('red0');
            }
            var num = $(this).parents('.hall_font_main').find('input[type=checkbox]:checked').length;
            $('#zhu').html(num);
        })
        //全清
        $('.clear').click(function () {
            if($(this).parents().is('.package')){
                $(this).parents('.package').find('li').removeClass('red0');
                $(this).parents('.package').find('input:checkbox').attr('checked',false);
            }else{
                $(this).parents('.hall_font_main').find('.package li').removeClass('red0');
                $(this).parents('.hall_font_main').find('.package input:checkbox').attr('checked',false);
            }
            $(this).removeClass('red0');
            var num = $(this).parents('.hall_font_main').find('input[type=checkbox]:checked').length;
            $('#zhu').html(num);
        })

    })
</script>
</body>
</html>
